import { getToken, setToken, removeToken, removeForm } from '@/utils/auth'

export default {
  // 一定要记住写这个namespaced:true
  namespaced: true,
  state: {
    // 获取token
    token: getToken() || ''
  },
  mutations: {
    // 存本地
    setToken(state, newToken) {
      state.token = newToken
      setToken(newToken)
    },
    delSubmit(state) {
      state.token = ''
      removeToken()
      removeForm()
    }

  },
  actions: {}
}
